import Vue from 'vue'
import VueRouter from './rewirte'
Vue.use(VueRouter)
import routes from './routes'
export const constantRoutes = routes
// 生成路由
const createRouter = () =>
	new VueRouter({
		scrollBehavior: () => ({ y: 0 }),
		routes,
	})

const router = createRouter()

// 重置路由
export function resetRouter() {
	const newRouter = createRouter()
	router.matcher = newRouter.matcher // reset router
}

export default router
